// miniprogram/pages/jingxuan/jinxuan.js
const db=require('../../assets/db')

Page({

  /**
   * 页面的初始数据
   */
  data: {
    entities:db.video,
    entities3:db.usersss,
    currentVid:null,
    constrols: true,
    loop: false,
    showprogress: true,
    autoplay: false,
    muted: false,
    whether: true
  },
  onShareAppMessage: function( ops ){
    if(ops.from === 'button'){
      console.log(ops.target)
    }
    return{
      title:"转发",
      path:`pages/index/index`,
      success:function(res){
        console.log("转发成功:" )
      },
      fail: function(res){
        console.log("转发失败")
      }
    }
  },
  addmore(){
    this.setData({
      whether:false
    })
  },
  discuss(e){
    console.log(e);
    let a=e.currentTarget.dataset.id
          wx.navigateTo({
            url: `../jx-taolun/jx-taolun?a=`+a
          })
  },
  play(event){
    console.log(event);
    const vid=event.target.dataset.vid;
    if(vid){
      //api
      let currentVideo=wx.createVideoContext("video"+vid);
      currentVideo.play()
      this.setData({
        currentVid:vid
      })
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(e) {
    console.log(e)
    wx.showShareMenu({
      withShareTicket: true
    })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})